using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Box2D.XNA;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input.Touch;

namespace Elementum
{
    public class Actor:PhysicObject
    {
        protected Vector2 _iniPosition;
        protected bool _isLive=true;

        public delegate void UpDateActionHandler();
        public event UpDateActionHandler UpDateAction;

     
        protected Stage GameStage
        {
            get;set;
        }

        public int ElementCount
        {
            get;
            set;
        }

        public Vector2 IniPosition {
            get { 
                return _iniPosition;
            }
            set
            {
                _iniPosition = value;
                Position = value;
            }
        }



        public Actor(World world,Stage stage):base(world)
        {
            this.GameStage = stage;
            ElementCount = 0;
        }

        public override void CreatBody(World world)
        {
            this._world = world;
            BodyDef bodyDef = new BodyDef();
            _body = world.CreateBody(bodyDef);
            _body.Owner = this;
            _body._type = BodyType.Dynamic;
        }

        public override void Update(int delta)
        {
            base.Update(delta);
            if (UpDateAction != null)
                UpDateAction();
            UpDateAction = null;
        }

        public override void OnDraw(SpriteBatch spriteBatch, Matrix transform)
        {
            base.OnDraw(spriteBatch, transform);
        }

        public virtual void Kill()
        {
        }

    }
}
